﻿namespace FiftyOne.Foundation.Mobile.Configuration
{
    using System;
    using System.Configuration;

    public class LogSection : ConfigurationSection
    {
        internal bool Enabled
        {
            get
            {
                return base.ElementInformation.IsPresent;
            }
        }

        [ConfigurationProperty("logFile", IsRequired=false), StringValidator(InvalidCharacters="!@#$%^&*()[]{};'\"|", MaxLength=0xff)]
        public string LogFile
        {
            get
            {
                return (string) base["logFile"];
            }
        }

        [StringValidator(InvalidCharacters="!@#$%^&*()[]{};'\"|", MaxLength=5), ConfigurationProperty("logLevel", IsRequired=false)]
        public string LogLevel
        {
            get
            {
                return (string) base["logLevel"];
            }
        }

        [ConfigurationProperty("pageLogDirectory", IsRequired=false), StringValidator(InvalidCharacters="!@#$%^&*()[]{};'\"|", MaxLength=0xff)]
        public string PageLogDirectory
        {
            get
            {
                return Support.GetFilePath((string) base["pageLogDirectory"]);
            }
        }
    }
}

